/*
 * usb.c
 *
 *  Created on: 02-02-2012
 *      Author: Mateusz
 */

#include "LPC13xx.h"

void USBIOClkConfig(void) {
	/* Enable AHB clock to the GPIO domain. */

	LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6);

	LPC_IOCON->PIO0_1 &= ~0x07;
	LPC_IOCON->PIO0_1 |= 0x01; /* CLK OUT */

	/* Enable AHB clock to the USB block. */

	LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 14);
	LPC_IOCON->PIO0_3 &= ~0x1F;
	LPC_IOCON->PIO0_3 |= 0x01; /* Secondary function VBUS */
	//LPC_IOCON->PIO0_6   &= ~0x07;
	//LPC_IOCON->PIO0_6   |= 0x01;		/* Secondary function SoftConn */
	return;
}
